package com.ywger.service.result;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chenmeng
 * @date 2018-12-13 17:33
 * @desc
 */
public class PageResult<T> {

    /**
     * 内容
     */
    private List<T> list;

    /**
     * 当前页码 default 1
     */
    private int pageNum;

    /**
     * 页大小 default 10
     */
    private int pageSize;

    /**
     * 总页数
     */
    private long totalPage;

    /**
     * 总记录数
     */
    private long totalCount;

    public PageResult(int pageNum,int pageSize) {
        this.pageSize = pageSize;
        this.pageNum = pageNum;
        init();
    }

    public void init() {
        this.list = new ArrayList<>();
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public Long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Long totalCount) {
        this.totalCount = totalCount;
    }

    public Long getTotalPage() {
        return (totalCount-1/pageSize)+1;
    }

    public void setTotalPage(Long totalPage) {
        this.totalPage = totalPage;
    }

}
